//
//  BKMyOrderRetuanGoodsProgressListController.m
//  bestkeep
//
//  Created by Mr. Wu on 16/12/20.
//  Copyright © 2016年 utouu. All rights reserved.
//

#import "BKMyOrderRetuanGoodsProgressListController.h"
#import "BK_OD_Tool.h"
#import "BKmyOrderReturnGoodProgressListTableCell.h"
#define COLOR_04 HexColor(0x03bfa0)
@interface BKMyOrderRetuanGoodsProgressListController ()
@property(nonatomic, strong)NSArray *dataArr;
@end

@implementation BKMyOrderRetuanGoodsProgressListController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"退换货进度列表";
    [self initView];
   
}
-(void)initView{
      self.automaticallyAdjustsScrollViewInsets=NO;
    _dataArr = @[@"退换货成功",@"商家核对商品成功",@"商家审核通过",@"官方审核通过",@"待审核"];
    
    UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 64, self.view.bounds.size.width, 100)];
    view.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:view];
    UILabel *questionLabel = [UILabel new];
    questionLabel.text = @"问题描述:";
    questionLabel.textColor = [UIColor blackColor];
    questionLabel.font = [UIFont systemFontOfSize:14];
    [view addSubview:questionLabel];
    [questionLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(view.mas_top).offset(10);
        make.left.equalTo(view.mas_left).offset(ApplicationBackGauge);
        make.width.equalTo(@(100));
    }];
    
    UILabel *questiondetail = [UILabel new];
    questiondetail.textColor = [UIColor grayColor];
    questiondetail.font = [UIFont systemFontOfSize:13];
    questiondetail.text = _model.reason;
    [view addSubview:questiondetail];
    [questiondetail mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(questionLabel.mas_bottom).offset(10);
        make.left.equalTo(view.mas_left).offset(ApplicationBackGauge);
        make.right.equalTo(view.mas_right);
    }];
    
    UILabel *lineLabel = [UILabel new];
    lineLabel.backgroundColor = [UIColor colorWithWhite:0.902 alpha:1.000];
    [view addSubview:lineLabel];
    [lineLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(view.mas_left).offset(0);
        make.right.equalTo(view.mas_right);
        make.height.mas_equalTo(@(1));
        make.top.mas_equalTo(questiondetail.mas_top).offset(20);
    }];
    
    UILabel *scheL = [UILabel new];
    scheL.text = @"审核进度:";
    scheL.textColor = [UIColor blackColor];
    scheL.font = [UIFont systemFontOfSize:14];
    [view addSubview:scheL];
    [scheL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(lineLabel.mas_top).offset(10);
        make.left.equalTo(view.mas_left).offset(ApplicationBackGauge);
        make.width.equalTo(@(100));
    }];
    
    
    _tableV =[[UITableView alloc]initWithFrame:CGRectZero style:UITableViewStylePlain];
    _tableV.delegate = self;
    _tableV.dataSource = self;
    _tableV.separatorStyle = UITableViewCellSeparatorStyleNone;
    _tableV.backgroundColor =RGB(242, 242, 242);
    [_tableV registerClass:[BKmyOrderReturnGoodProgressListTableCell class] forCellReuseIdentifier:@"cell"];
    [self.view addSubview:_tableV];
    [_tableV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view.mas_left);
        make.right.equalTo(self.view.mas_right);
        make.top.equalTo(view.mas_bottom).offset(0);
        make.bottom.equalTo(self.view.mas_bottom).offset(0);
    }];
    
    
    
}


- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 5;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 90;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
   BKmyOrderReturnGoodProgressListTableCell *cell = [_tableV dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];
    cell.userInteractionEnabled = NO;
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    NSInteger value = [_dataArr indexOfObject:_model.statusStr];
    for (NSString *string in _dataArr) {
        if (![cell.detailLabel.text isEqualToString:string]) {
            if (indexPath.row == 4) {
                cell.detailLabel.textColor = COLOR_04;
                cell.lineLabel.backgroundColor = COLOR_04;
                cell.collectLabel.backgroundColor = COLOR_04;
            }
        }
    }
    if (indexPath.row>= value) {
        cell.detailLabel.textColor = COLOR_04;
        cell.lineLabel.backgroundColor = COLOR_04;
        cell.collectLabel.backgroundColor = COLOR_04;
    }
    cell.detailLabel.text = _dataArr[indexPath.row];
    return cell;
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
